#include<stdio.h>
#include<sys/stat.h>
#include<sys/types.h>
#include<unistd.h>
#include<stdlib.h>
#include<fcntl.h>
#include<string.h>
//客户端，发送数据
int main(){
  char buffer[64];
  int fd = open("fifo",O_WRONLY);

  if(fd < 0){
    perror("open error!\n");
    return 1;
  }
  while(1){
    printf("Please Enter Message #:");
    fflush(stdout);
    ssize_t s = read(0,buffer,sizeof(buffer)-1);
    if(s > 0){
      buffer[s] = 0;
      write(fd,buffer,s); 
    } 
  }

  close(fd);

  return 0;
}
